import {
	ILoginViewAbility,
	ILoginViewController,
	ILoginViewControllerParams,
	ILoginViewStore,
	LoginViewActionType,
	IParam,
} from '@/core/interface';
import { ViewController } from './view-controller';

/**
 * 登录视图控制器
 *
 * @export
 * @class LoginViewController
 * @extends {ViewController}
 */
export class LoginViewController
	extends ViewController<
		LoginViewActionType,
		ILoginViewStore,
		ILoginViewAbility
	>
	implements ILoginViewController<ILoginViewStore, ILoginViewAbility>
{
	/**
	 * 处理视图初始化
	 *
	 * @protected
	 * @param {ILoginViewControllerParams<LoginViewActionType, ILoginViewAbility>} params
	 * @memberof LoginViewController
	 */
	protected processViewInit(
		params: ILoginViewControllerParams<LoginViewActionType, ILoginViewAbility>
	) {
		super.processViewInit(params);
	}

	/**
	 * 视图加载
	 *
	 * @param {IParam} [opts={}]
	 * @return {*}
	 * @memberof LoginViewController
	 */
	public viewMounted(opts: IParam = {}) {
		super.viewMounted(opts);
		App.closeAppLoadding();
		if (this.model.useDefaultLayout) {
			if (!this.isLoadDefault) {
				this.isLoadDefault = true;
				return;
			}
		} else {
			this.initLayout();
		}
	}
}
